package com.ty.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ty.mapper.FettersAndPaertnerMapper;
import com.ty.pojo.FettersAndPaertner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FettersAndPaertnerServiceImpl implements FettersAndPaertnerService{
    @Autowired
    private FettersAndPaertnerMapper fettersAndPaertnerMapper;

    @Override
    public void addPartner(FettersAndPaertner fettersAndPaertner) {
        fettersAndPaertnerMapper.insert(fettersAndPaertner);
    }

    @Override
    public void deletePartner(FettersAndPaertner fettersAndPaertner) {
        QueryWrapper<FettersAndPaertner> queryWrapper = new QueryWrapper<>();
        queryWrapper.and(Wrapper -> Wrapper.eq("fetters_id", fettersAndPaertner.getFettersId())
                .eq("partner_id", fettersAndPaertner.getPartnerId()));
        fettersAndPaertnerMapper.delete(queryWrapper);
    }
}
